------------------------------------------------------------------------------------------------------------------------------------
      name:  plog_908
       log:  /accounts/projects/jr_ra/GRscarring/erratum/programs/analysis/fig_atcfxbygender.log
  log type:  text
 opened on:  27 Nov 2024, 18:05:54

. ***************************************************************************************************************
. * fig_atcfxbygender.do
. * JR, 4/24/2020, based on fig_atcfx.do
. *
. * Edits:
. 
. ***************************************************************************************************************  
. clear

. cap project, doinfo

. if _rc==0 {
.         local pdir "`r(pdir)'"                                                      // the project's main dir.
.         local dofile "`r(dofile)'"                                                  // do-file's stub name
.         local sig {bind:{hi:[`dofile'.dta. RP : `dofile'.do, `c(current_date)']}}       // a signature in notes
.         local doasproject=1
. }

. else {
.         local pdir "~/GRscarring"
.         local dofile "fig_atcfxbygender"
.         local doasproject=0
. }

. 
. set more off

. local rootdir "`pdir'"

. local thisdir "`pdir'"

. 
. local scratch "`pdir'/scratch"

. local rawdata "`pdir'/rawdata"

. local output "`pdir'/results"

. 
. set scheme s1color

. 
. if `doasproject'==1 {
.         project, uses(`scratch'/recessionlist.dta)
project GRscar_erratum > do-file uses: "/scratch/public/jr_ra/GRscarring2024/erratum/scratch/recessionlist.dta" filesig(1425014852:1
> 5851)
.         project, uses(`scratch'/runatc_bygender_coeffs.dta)
project GRscar_erratum > do-file uses: "/scratch/public/jr_ra/GRscarring2024/erratum/scratch/runatc_bygender_coeffs.dta" filesig(130
> 8389247:1763539)
. }

. 
. local depvars "empl rw_l log_pearnval_tc_r"

. 
. use `scratch'/runatc_bygender_coeffs, clear

. gen keep=.
(18,888 missing values generated)

. foreach v of local depvars {
  2.   replace keep=1 if depvar=="`v'"
  3. }
(6,344 real changes made)
(6,344 real changes made)
(6,200 real changes made)

. keep if keep==1
(0 observations deleted)

. drop keep

. keep if ivartype=="FV" & fvname=="entrycohort"
(13,148 observations deleted)

. replace b = b*100 if depvar=="empl"
(1,868 real changes made)

. rename fvval entrycohort

. gen educ=real(substr(model,3,1))

. tempfile coeffs

. save `coeffs'
file /tmp/St2868349.000004 saved as .dta format

. 
. // Now convert to monthly data for recession shading
. 
.         gen month=ym(entrycohort, 7)

. 
.         tempfile base

.         save `base'
file /tmp/St2868349.000005 saved as .dta format

.         su month, meanonly

.         local fmonth=r(min)

.         local lmonth=r(max)

. 
.         use `scratch'/recessionlist, clear

.         keep if month>=`fmonth'-6 & month<=`lmonth'+5
(300 observations deleted)

.         gen model="recession"

.         append using `base'

. 
.         *Drop observations from before the 1978 birthcohort
. *       drop if month<ym(1978,7)
.         drop if month<ym(1970,1)
(0 observations deleted)

.         
.         *Drop observations from the last cohort, for which we have only a single observation
.          *For now (4/16/2020), this is 2019 for bigcps outcomes, 2019 for MORG, and 2017 for March
.          *Note that code is for specific dependent variables -- all others are set to missing
.          *for safety
.          drop if depvar=="empl" & month>ym(2018,12)
(20 observations deleted)

.          drop if depvar=="rw_l" & month>ym(2018,12)
(20 observations deleted)

.          drop if depvar=="log_pearnval_tc_r" & month>=ym(2016,7)
(40 observations deleted)

.          drop if !inlist(depvar, "empl", "rw_l", "log_pearnval_tc_r") & !inlist(model,"recession", "means")
(0 observations deleted)

. 
.     gen altrecession=recession
(5,660 missing values generated)

.     gen zero=0 

. 
. // baseline ATC decomposition
.    replace altrecession=-8+12*recession
(576 real changes made)

.    twoway area altrecession month if model=="recession", color(gs13) base(-8) || ///
>           line b month if model=="mB10b" & depvar=="empl", lstyle(p1) || ///
>           line b month if model=="mB11b" & depvar=="empl", lstyle(p2) || ///
>           line zero month if model=="recession", lpattern(dot) lcolor(black) || ///
>                    , xlabel( 126 "1970" 246 "1980" 366 "1990" 486 "2000" 606 "2010" 726 "2020" )  ///
>                      ylabel(-8 (4) 4) ///
>                      legend(order(2 "Female" 3 "Male") cols(1) ring(0) pos(7)) ///
>                      ytitle("Employment rate (%, 1984=2000=0)") xtitle("Entry cohort") ///
>                          title("Cohort effects on employment rates, college graduates, by gender", size(medsmall)) ///
>                      saving("`output'/`dofile'_cohortA_empl.gph", replace)
file /accounts/projects/jr_ra/GRscarring/erratum/results/fig_atcfxbygender_cohortA_empl.gph saved

. 
.    replace altrecession=-0.11 + 0.21*recession
(576 real changes made)

.    twoway area altrecession month if model=="recession", color(gs13) base(-0.11) || ///
>           line b month if model=="mB10b" & depvar=="rw_l", lstyle(p1) || ///
>           line b month if model=="mB11b" & depvar=="rw_l", lstyle(p2) || ///
>           line zero month if model=="recession", lpattern(dot) lcolor(black) || ///
>                    , xlabel( 126 "1970" 246 "1980" 366 "1990" 486 "2000" 606 "2010" 726 "2020" )  ///
>                      legend(order(2 "Female" 3 "Male") cols(1) ring(0) pos(5)) ///
>                      ytitle("Log real hourly wage (1984=2000=0)") xtitle("Entry cohort") ///
>                          title("Cohort effects on log real wages, college graduates, by gender", size(medsmall)) ///
>                      saving("`output'/`dofile'_cohortA_rw_l.gph", replace)
file /accounts/projects/jr_ra/GRscarring/erratum/results/fig_atcfxbygender_cohortA_rw_l.gph saved

. 
. // Effects of scarring and excess sensitivity by gender
.    replace altrecession=-8+12*recession
(576 real changes made)

.    twoway area altrecession month if model=="recession", color(gs13) base(-8) || ///
>           line b month if model=="mB10b" & depvar=="empl", lstyle(p1) || ///
>           line b month if model=="mE10b" & depvar=="empl", lstyle(p2) lpattern(dash)  || ///
>            line zero month if model=="mE10b" & depvar=="empl", lpattern(dot) lcolor(black) || ///
>                    , xlabel( 126 "1970" 246 "1980" 366 "1990" 486 "2000" 606 "2010" 726 "2020" )  ///
>                      ylabel(-8 (2) 2) ///
>                      legend(off) ///
>                      ytitle("Employment rate (%, 1984=2000=0)") xtitle("Entry cohort") nodraw ///
>                          title("A. Female employment", size(medsmall)) name(scarring_fem, replace) 

.    twoway area altrecession month if model=="recession", color(gs13) base(-8) || ///
>           line b month if model=="mB11b" & depvar=="empl", lstyle(p1) || ///
>           line b month if model=="mE11b" & depvar=="empl", lstyle(p2) lpattern(dash)  || ///
>            line zero month if model=="mE11b" & depvar=="empl", lpattern(dot) lcolor(black) || ///
>                    , xlabel( 126 "1970" 246 "1980" 366 "1990" 486 "2000" 606 "2010" 726 "2020" )  ///
>                      ylabel(-8 (2) 2) ///
>                      legend(order(2 "Baseline" 3 "Scarring & excess sensitivity") cols(1) ring(0) pos(7)) ///
>                      ytitle("Employment rate (%, 1984=2000=0)") xtitle("Entry cohort") ///
>                          title("B. Male employment", size(medsmall)) name(scarring_men, replace) nodraw

.    graph combine scarring_fem scarring_men, ///
>                      saving("`output'/`dofile'_cohortB_empl.gph", replace)
file /accounts/projects/jr_ra/GRscarring/erratum/results/fig_atcfxbygender_cohortB_empl.gph saved

. 
.    replace altrecession=-0.15 + 0.25*recession
(576 real changes made)

.    twoway area altrecession month if model=="recession", color(gs13) base(-0.15) || ///
>           line b month if model=="mB10b" & depvar=="rw_l", lstyle(p1) || ///
>           line b month if model=="mE10b" & depvar=="rw_l", lstyle(p2) lpattern(dash)  || ///
>            line zero month if model=="mE10b" & depvar=="rw_l", lpattern(dot) lcolor(black) || ///
>                    , xlabel( 126 "1970" 246 "1980" 366 "1990" 486 "2000" 606 "2010" 726 "2020" )  ///
>                      legend(order(2 "Baseline" 3 "Scarring & excess sensitivity") cols(1) ring(0) pos(11)) ///
>                      ytitle("Log real hourly wage (%, 1984=2000=0)") xtitle("Entry cohort") nodraw ///
>                          title("C. Female log wages", size(medsmall)) name(scarring_fem, replace) 

.    twoway area altrecession month if model=="recession", color(gs13) base(-0.15) || ///
>           line b month if model=="mB11b" & depvar=="rw_l", lstyle(p1) || ///
>           line b month if model=="mE11b" & depvar=="rw_l", lstyle(p2) lpattern(dash) || ///
>            line zero month if model=="mE11b" & depvar=="rw_l", lpattern(dot) lcolor(black) || ///
>                    , xlabel( 126 "1970" 246 "1980" 366 "1990" 486 "2000" 606 "2010" 726 "2020" )  ///
>                      legend(off) ///
>                      ytitle("Log real hourly wage (%, 1984=2000=0)") xtitle("Entry cohort") ///
>                          title("D. Male log wages", size(medsmall)) name(scarring_men, replace) nodraw

.    graph combine scarring_fem scarring_men, ///
>                      saving("`output'/`dofile'_cohortB_rw_l.gph", replace)
file /accounts/projects/jr_ra/GRscarring/erratum/results/fig_atcfxbygender_cohortB_rw_l.gph saved

.                  
.   save `scratch'/`dofile', replace
(file /accounts/projects/jr_ra/GRscarring/erratum/scratch/fig_atcfxbygender.dta not found)
file /accounts/projects/jr_ra/GRscarring/erratum/scratch/fig_atcfxbygender.dta saved

. 
. 
. if `doasproject'==1 {
.   project, creates(`scratch'/`dofile'.dta)
project GRscar_erratum > do-file creates: "/scratch/public/jr_ra/GRscarring2024/erratum/scratch/fig_atcfxbygender.dta" filesig(18230
> 39418:864487)
.   project, creates(`output'/`dofile'_cohortA_empl.gph)
project GRscar_erratum > do-file creates: "results/fig_atcfxbygender_cohortA_empl.gph" filesig(723193626:26333)
.   project, creates(`output'/`dofile'_cohortA_rw_l.gph)
project GRscar_erratum > do-file creates: "results/fig_atcfxbygender_cohortA_rw_l.gph" filesig(2498143020:26188)
.   project, creates(`output'/`dofile'_cohortB_empl.gph)
project GRscar_erratum > do-file creates: "results/fig_atcfxbygender_cohortB_empl.gph" filesig(2509610765:44681)
.   project, creates(`output'/`dofile'_cohortB_rw_l.gph)
project GRscar_erratum > do-file creates: "results/fig_atcfxbygender_cohortB_rw_l.gph" filesig(3254834760:44479)
. }

.     
. 
end of do-file
      name:  plog_908
       log:  /accounts/projects/jr_ra/GRscarring/erratum/programs/analysis/fig_atcfxbygender.log
  log type:  text
 closed on:  27 Nov 2024, 18:06:01
------------------------------------------------------------------------------------------------------------------------------------
